//
//  SelectedGoodCell.m
//  TryShopping
//
//  Created by panquanReabam.com on 16/10/19.
//  Copyright © 2016年 RuiBen. All rights reserved.
//

#import "SelectedGoodCell.h"
#import "GetAddBuyGoodsView.h"
#import "GetAddBuyGoodsView1.h"
@interface SelectedGoodCell()

@end
@implementation SelectedGoodCell
{
    GetAddBuyGoodsView1*GoodView1;
    GetAddBuyGoodsView*GoodView;
    NSString*isSuit;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
//        [self createView];
//        [self setViewAutoLayout];
    }
    return self;
}
-(void)setGoodsInOrderListModel:(SelectedGoodNewHeaderDataModel *)GoodsInOrderListModel{

    if(![[NSString stringWithFormat:@"%@",GoodsInOrderListModel.combiMainId]isEqualToString:@""]&&[[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planType]isEqualToString:@"P003"]) {
    
   
    }else{
    
    if (GoodsInOrderListModel.plans.count>0) {
    NSString *s1 =[NSString stringWithFormat:@"%@",GoodsInOrderListModel.spTypeName];
    UIFont *font1 = [UIFont systemFontOfSize:13];
    CGSize size1 = CGSizeMake(ScreenWidth-60, 2000);
    CGSize labelsize1 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
    _conditions=[[UILabel alloc] initWithFrame:CGRectMake(15, 15, labelsize1.width, 13)];
    [_conditions setText:GoodsInOrderListModel.spTypeName];
    _conditions.font=[UIFont systemFontOfSize:12];
    _conditions.backgroundColor=[UIColor colorWithRed:255/255.0 green:51/255.0 blue:0/255.0 alpha:1];
    _conditions.textAlignment=NSTextAlignmentCenter;
    _conditions.textColor=[UIColor whiteColor];
    [self addSubview:_conditions];
   _conditionsLabel=[[UILabel alloc] initWithFrame:CGRectMake(_conditions.right+5, 15, ScreenWidth-labelsize1.width-15-95, 12)];
    
   if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.spType]isEqualToString:@"buySuit"]&&GoodsInOrderListModel.items.count>0) {
       [_conditionsLabel setText:[NSString stringWithFormat:@"%@ ￥%@元",@"促销套餐",[NSString stringWithFormat:@"%@",GoodsInOrderListModel.suitPrice]]];
        
    }else{
           if ([[NSString stringWithFormat:@"%@",GoodsInOrderListModel.promotionPrice] isEqualToString:@"0"]) {
               if ([[NSString stringWithFormat:@"%@",GoodsInOrderListModel.spType] isEqualToString:@""]) {
                   
               }else{
               [_conditionsLabel setText:GoodsInOrderListModel.planTitle];
               }
           
           }else{
               
               if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planType]isEqualToString:@"P003"]) {
                    [_conditionsLabel setText:[NSString stringWithFormat:@"%@ 已优惠%@元",[NSString stringWithFormat:@"%@",GoodsInOrderListModel.planTitle],[NSString stringWithFormat:@"%.2f",[GoodsInOrderListModel.combiPromotion floatValue]]]];
               }else{
               [_conditionsLabel setText:[NSString stringWithFormat:@"%@ 已优惠%@元",[NSString stringWithFormat:@"%@",GoodsInOrderListModel.planTitle],[NSString stringWithFormat:@"%.2f",[GoodsInOrderListModel.promotionPrice floatValue]]]];
               }
           
           
           }

    
    }
    _conditionsLabel.font=[UIFont systemFontOfSize:12];
    _conditionsLabel.textColor=[UIColor colorWithRed:102.0/255.0f green:102.0/255.0f  blue:102.0/255.0f  alpha:1.0];
    [self addSubview:_conditionsLabel];
    

    }
}
 //72X72Suit类型已经是套餐

        if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.productType]isEqualToString:@"Suit"]) {

            _productImageView=[[UIImageView alloc] initWithFrame:CGRectMake(15, 40, 72, 72)];
            _productImageView.layer.borderColor=[[UIColor colorWithRed:239.0f/255.0f green:239.0f/255.0f blue:239.0f/255.0f alpha:1] CGColor];
            _productImageView.layer.borderWidth= 0.5f;
            [_productImageView setImageWithURL:[NSURL URLWithString:GoodsInOrderListModel.headImageFull] placeholderImage:[UIImage imageNamed:@"zhengfangxing"]];
            [self addSubview:_productImageView];
            
           
            NSString *itemName =[NSString stringWithFormat:@"%@", GoodsInOrderListModel.itemName ];
            UIFont *itemNamefont1 = [UIFont systemFontOfSize:14];
            CGSize itemNamesize1 = CGSizeMake( ScreenWidth-125, 2000);
            CGSize itemNamelabelsize1 = [itemName sizeWithFont:itemNamefont1 constrainedToSize:itemNamesize1 lineBreakMode:NSLineBreakByCharWrapping];
       
            _productNameLabel=[[UILabel alloc] initWithFrame:CGRectMake(99, 40,  ScreenWidth-125, itemNamelabelsize1.height)];
            [_productNameLabel setText:[NSString stringWithFormat:@"%@",   GoodsInOrderListModel.itemName]];
            _productNameLabel.font=[UIFont systemFontOfSize:14];
            _productNameLabel.numberOfLines=0;
            _productNameLabel.textColor=[UIColor colorWithRed:51.0/255.0f green:51.0/255.0f  blue:51.0/255.0f  alpha:1.0];
            [self addSubview:_productNameLabel];
            
  
            if ([[Global getJudgeTheErrorStr:GoodsInOrderListModel.specName]isEqualToString:@""] ||GoodsInOrderListModel.specName==NULL ) {
                
            }else{
                _productSpecNameLabel=[[UILabel alloc] initWithFrame:CGRectMake(99, 75, 200, 14)];
                [_productSpecNameLabel setText:[NSString stringWithFormat:@"%@",GoodsInOrderListModel.specName ]];
                _productSpecNameLabel.font=[UIFont systemFontOfSize:12];
                _productSpecNameLabel.textColor=[UIColor colorWithRed:102.0/255.0f green:102.0/255.0f  blue:102.0/255.0f  alpha:1.0];
                [self addSubview:_productSpecNameLabel];
            }
            _productPriceLabel=[[UILabel alloc] initWithFrame:CGRectMake(99, 100, 200, 15)];
            [_productPriceLabel setText:[NSString stringWithFormat:@"¥ %0.02f",[GoodsInOrderListModel.dealPrice floatValue]]];
            _productPriceLabel.font=[UIFont systemFontOfSize:12];
            _productPriceLabel.textColor=[UIColor colorWithRed:102.0/255.0f green:102.0/255.0f  blue:102.0/255.0f  alpha:1.0];
            [self addSubview:_productPriceLabel];
            _productInvLabel=[[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth-125, 73, 110, 15)];
            [_productInvLabel setText:[NSString stringWithFormat:@"库存 %d",[GoodsInOrderListModel.invQty intValue]]];
            _productInvLabel.font=[UIFont systemFontOfSize:12];
            _productInvLabel.textColor=[UIColor colorWithRed:109.0/255.0f green:102.0/255.0f  blue:102.0/255.0f  alpha:1.0];
            NSString *str=[NSString stringWithFormat:@"库存 %d",[GoodsInOrderListModel.invQty intValue]];
            NSMutableAttributedString *attriString = [[NSMutableAttributedString alloc] initWithString:str];
            [attriString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0] range:NSMakeRange(0, 2)];
            
            _productInvLabel.attributedText=attriString;
            _productInvLabel.textAlignment=NSTextAlignmentRight;
            [self addSubview:_productInvLabel];
            
            
            UILabel*quantity = [[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-100, 100, 85, 13)];
            quantity.font=[UIFont systemFontOfSize:12];
            quantity.textAlignment=NSTextAlignmentRight;
            quantity.textColor=shenhuiColor;
            quantity.text=[NSString stringWithFormat:@"%@件/套 x %@",GoodsInOrderListModel.suitItemQty ,GoodsInOrderListModel.suitQty];
            [self addSubview:quantity];

            _countParentView=[[UIView alloc] initWithFrame:CGRectMake(ScreenWidth-125, 125+GoodsInOrderListModel.items.count*100, 110, 30)];
            _countParentView.layer.borderWidth=1.0;
            _countParentView.layer.borderColor=[UIColor colorWithRed:240.0/255.0f green:240.0/255.0f blue:240.0/255.0f alpha:240.0/255.0f].CGColor;
            [self addSubview:_countParentView];
            _subtractCountBtn=[UIButton buttonWithType:UIButtonTypeCustom];
            [_subtractCountBtn setImage:[UIImage imageNamed:@"jian_hui.png"] forState:UIControlStateNormal];
            [_subtractCountBtn setFrame:CGRectMake(0, 0, 30,30)];
            [_subtractCountBtn addTarget:self action:@selector(subtractCountBtn:) forControlEvents:UIControlEventTouchUpInside];
            [_subtractCountBtn setTitle:@"Y" forState:UIControlStateNormal];
            [_subtractCountBtn setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
            [_countParentView addSubview:_subtractCountBtn];
            
            _noSpecCountTextfield=[[UITextField alloc] initWithFrame:CGRectMake(30, 0, 50, 30)];
            _noSpecCountTextfield.text=[NSString stringWithFormat:@" %d",[GoodsInOrderListModel.suitQty intValue]];
            _noSpecCountTextfield.textColor=[UIColor colorWithRed:21.0/255.0 green:25.0/255.0 blue:32.0/255.0 alpha:1.0f];
            _noSpecCountTextfield.font=[UIFont systemFontOfSize:15];
            _noSpecCountTextfield.textAlignment=NSTextAlignmentCenter;
            [_noSpecCountTextfield setUserInteractionEnabled:NO];
            [_countParentView addSubview:_noSpecCountTextfield];
            _CountBtn=[UIButton buttonWithType:UIButtonTypeCustom];
            [_CountBtn setFrame:CGRectMake(0, 0, 50,30)];
            _CountBtn.center=_noSpecCountTextfield.center;
            [_CountBtn setTitle:@"Y" forState:UIControlStateNormal];
            [_CountBtn setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
            [_CountBtn addTarget:self action:@selector(countBtn:) forControlEvents:UIControlEventTouchUpInside];
            [_countParentView addSubview:_CountBtn];
            _addCountBtn=[UIButton buttonWithType:UIButtonTypeCustom];
            [_addCountBtn setImage:[UIImage imageNamed:@"jia.png"] forState:UIControlStateNormal];
            [_addCountBtn setFrame:CGRectMake(80, 0, 30, 30)];
            [_addCountBtn setTitle:@"Y" forState:UIControlStateNormal];
            [_addCountBtn setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
            [_addCountBtn addTarget:self action:@selector(addCountBtn:) forControlEvents:UIControlEventTouchUpInside];
            [_countParentView addSubview:_addCountBtn];
   
            UILabel*suitMoney = [[UILabel alloc]initWithFrame:CGRectMake(15, 125+GoodsInOrderListModel.items.count*100, 185, 38)];
            suitMoney.font=[UIFont systemFontOfSize:14];
            suitMoney.textColor=hongseColor;
            suitMoney.text=[NSString stringWithFormat:@"套餐￥ %@",GoodsInOrderListModel.suitMoney];
            [self addSubview:suitMoney];

        }else{
        
        
//82X82（没选择优惠的每一条产品）
            
            if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.productType]isEqualToString:@"Gift"]) {
           
                
               UILabel* Gift = [[UILabel alloc] initWithFrame:CGRectMake(109, 21, 25, 14)];
                Gift.textColor=hongseColor;
                Gift.text=@"赠品";
                Gift.textAlignment=NSTextAlignmentCenter;
                Gift.font=[UIFont systemFontOfSize:11];
                [Gift.layer setCornerRadius:2.0]; //设置矩圆角半径
                [Gift.layer setBorderWidth:0.5];   //边框宽度
                CGColorSpaceRef tureBTnSpace = CGColorSpaceCreateDeviceRGB();
                CGColorRef tureBTncolorref = CGColorCreate(tureBTnSpace,(CGFloat[]){255/255.0, 54/255.0, 30/255.0, 1.0});
                [Gift.layer setBorderColor:tureBTncolorref];//边框颜色
                [self addSubview:Gift];
                NSString *s1 =[NSString stringWithFormat:@"    %@", GoodsInOrderListModel.itemName ];
                UIFont *font1 = [UIFont systemFontOfSize:14];
                CGSize size1 = CGSizeMake(ScreenWidth-125, 2000);
                CGSize labelsize12 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
                
                
                _productNameLabel=[[UILabel alloc] initWithFrame:CGRectMake(109, 40, ScreenWidth-125, labelsize12.height)];
                [_productNameLabel setText:[NSString stringWithFormat:@"    %@",  s1]];
                _productNameLabel.font=[UIFont systemFontOfSize:14];
                _productNameLabel.numberOfLines=0;
                _productNameLabel.textColor=[UIColor colorWithRed:51.0/255.0f green:51.0/255.0f  blue:51.0/255.0f  alpha:1.0];
                [self addSubview:_productNameLabel];

            
            }else{
            
                NSString *s1 =[NSString stringWithFormat:@"%@", GoodsInOrderListModel.itemName ];
                UIFont *font1 = [UIFont systemFontOfSize:14];
                CGSize size1 = CGSizeMake(ScreenWidth-125, 2000);
                CGSize labelsize12 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
                
                
                _productNameLabel=[[UILabel alloc] initWithFrame:CGRectMake(109, 40, ScreenWidth-125, labelsize12.height)];
                [_productNameLabel setText:[NSString stringWithFormat:@"%@",  s1]];
                _productNameLabel.font=[UIFont systemFontOfSize:14];
                _productNameLabel.numberOfLines=0;
                _productNameLabel.textColor=[UIColor colorWithRed:51.0/255.0f green:51.0/255.0f  blue:51.0/255.0f  alpha:1.0];
                [self addSubview:_productNameLabel];

            }
            
            
            _productImageView=[[UIImageView alloc] initWithFrame:CGRectMake(15, 40, 82, 82)];
            _productImageView.layer.borderColor=[[UIColor colorWithRed:239.0f/255.0f green:239.0f/255.0f blue:239.0f/255.0f alpha:1] CGColor];
            _productImageView.layer.borderWidth= 0.5f;
            [_productImageView setImageWithURL:[NSURL URLWithString:GoodsInOrderListModel.headImageFull] placeholderImage:[UIImage imageNamed:@"zhengfangxing"]];
            [self addSubview:_productImageView];
            
            
            
            if ([[Global getJudgeTheErrorStr:GoodsInOrderListModel.specName]isEqualToString:@""]||GoodsInOrderListModel.specName==NULL  ) {
                
            }else{
                _productSpecNameLabel=[[UILabel alloc] initWithFrame:CGRectMake(109, 75, 200, 15)];
                [_productSpecNameLabel setText:[NSString stringWithFormat:@"%@",GoodsInOrderListModel.specName ]];
                _productSpecNameLabel.font=[UIFont systemFontOfSize:12];
                _productSpecNameLabel.textColor=[UIColor colorWithRed:102.0/255.0f green:102.0/255.0f  blue:102.0/255.0f  alpha:1.0];
                [self addSubview:_productSpecNameLabel];
            }
            _productPriceLabel=[[UILabel alloc] initWithFrame:CGRectMake(109, 100, 200, 15)];
            [_productPriceLabel setText:[NSString stringWithFormat:@"¥ %0.02f",[GoodsInOrderListModel.dealPrice floatValue]]];
            _productPriceLabel.font=[UIFont systemFontOfSize:12];
            _productPriceLabel.textColor=[UIColor colorWithRed:102.0/255.0f green:102.0/255.0f  blue:102.0/255.0f  alpha:1.0];
            [self addSubview:_productPriceLabel];
            _productInvLabel=[[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth-125, 73, 110, 15)];
            [_productInvLabel setText:[NSString stringWithFormat:@"库存 %d",[GoodsInOrderListModel.invQty intValue]]];
            _productInvLabel.font=[UIFont systemFontOfSize:12];
            _productInvLabel.textColor=[UIColor colorWithRed:109.0/255.0f green:102.0/255.0f  blue:102.0/255.0f  alpha:1.0];
            NSString *str=[NSString stringWithFormat:@"库存 %d",[GoodsInOrderListModel.invQty intValue]];
            NSMutableAttributedString *attriString = [[NSMutableAttributedString alloc] initWithString:str];
            [attriString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0] range:NSMakeRange(0, 2)];
            
            _productInvLabel.attributedText=attriString;
            _productInvLabel.textAlignment=NSTextAlignmentRight;
            [self addSubview:_productInvLabel];
            
            _countParentView=[[UIView alloc] initWithFrame:CGRectMake(ScreenWidth-125, 92.6, 110, 30)];
            _countParentView.layer.borderWidth=1.0;
            _countParentView.layer.borderColor=[UIColor colorWithRed:240.0/255.0f green:240.0/255.0f blue:240.0/255.0f alpha:240.0/255.0f].CGColor;
            [self addSubview:_countParentView];
            _subtractCountBtn=[UIButton buttonWithType:UIButtonTypeCustom];
            [_subtractCountBtn setImage:[UIImage imageNamed:@"jian_hui.png"] forState:UIControlStateNormal];
            [_subtractCountBtn setFrame:CGRectMake(0, 0, 30,30)];
            [_subtractCountBtn addTarget:self action:@selector(subtractCountBtn:) forControlEvents:UIControlEventTouchUpInside];
            [_countParentView addSubview:_subtractCountBtn];
            
            _noSpecCountTextfield=[[UITextField alloc] initWithFrame:CGRectMake(30, 0, 50, 30)];
            _noSpecCountTextfield.text=[NSString stringWithFormat:@" %d",[GoodsInOrderListModel.quantity intValue]];
            _noSpecCountTextfield.textColor=[UIColor colorWithRed:21.0/255.0 green:25.0/255.0 blue:32.0/255.0 alpha:1.0f];
            _noSpecCountTextfield.font=[UIFont systemFontOfSize:15];
            _noSpecCountTextfield.textAlignment=NSTextAlignmentCenter;
            [_noSpecCountTextfield setUserInteractionEnabled:NO];
            [_countParentView addSubview:_noSpecCountTextfield];
            _CountBtn=[UIButton buttonWithType:UIButtonTypeCustom];
            [_CountBtn setFrame:CGRectMake(0, 0, 50,30)];
            _CountBtn.center=_noSpecCountTextfield.center;
            [_CountBtn addTarget:self action:@selector(countBtn:) forControlEvents:UIControlEventTouchUpInside];
            [_countParentView addSubview:_CountBtn];
            _addCountBtn=[UIButton buttonWithType:UIButtonTypeCustom];
            [_addCountBtn setImage:[UIImage imageNamed:@"jia.png"] forState:UIControlStateNormal];
            [_addCountBtn setFrame:CGRectMake(80, 0, 30, 30)];
            [_addCountBtn addTarget:self action:@selector(addCountBtn:) forControlEvents:UIControlEventTouchUpInside];
            [_countParentView addSubview:_addCountBtn];
            
            
}


if(![[NSString stringWithFormat:@"%@",GoodsInOrderListModel.combiMainId]isEqualToString:@""]&&[[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planType]isEqualToString:@"P003"]) { //是组合产品
    
    _productImageView.frame=CGRectMake(15, 20, 82, 82);
    _countParentView.frame=CGRectMake(ScreenWidth-125, 72, 110, 30);
    _productSpecNameLabel.frame=CGRectMake(109, 55, 200, 15);
    _productPriceLabel.frame=CGRectMake(109, 80, 200, 15);
    _productInvLabel.frame=CGRectMake(ScreenWidth-125, 55, 110, 15);
    NSString *s1 =[NSString stringWithFormat:@"%@", GoodsInOrderListModel.itemName ];
    UIFont *font1 = [UIFont systemFontOfSize:14];
    CGSize size1 = CGSizeMake(ScreenWidth-125, 2000);
    CGSize labelsize12 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
    _productNameLabel.frame=CGRectMake(109, 20, ScreenWidth-125, labelsize12.height);
    _productNameLabel.numberOfLines=0;
    
    if (GoodsInOrderListModel.plans.count>1) {//
        [self jiazaiView:[NSString stringWithFormat:@"%f",GoodsInOrderListModel.getWeiboHight]:GoodsInOrderListModel.plans ];
//        self.hengxianLine.frame=CGRectMake(10, GoodsInOrderListModel.getWeiboHight+142-0.45, ScreenWidth-20, 0.25);
    }else{
//        self.hengxianLine.frame=CGRectMake(10, GoodsInOrderListModel.getWeiboHight+142-0.45, ScreenWidth-20, 0.25);
    }

  

}else{
//1//////////////////buyMember会员优惠
  if ([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.spType]isEqualToString:@"buyMember"]&&GoodsInOrderListModel.plans.count>0) {
        
        if (GoodsInOrderListModel.plans.count>1) {//
            [self jiazaiView:[NSString stringWithFormat:@"%f",GoodsInOrderListModel.getWeiboHight]:GoodsInOrderListModel.plans ];
            
        }else{
            
}

    
//2//////////////////buySpecial特价
}else if ([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.spType]isEqualToString:@"buySpecial"]&&GoodsInOrderListModel.plans.count>0) {
        
        if (GoodsInOrderListModel.plans.count>1) {//
            [self jiazaiView:[NSString stringWithFormat:@"%f",GoodsInOrderListModel.getWeiboHight]:GoodsInOrderListModel.plans ];
            
        }else{
            
        }

 //3//////////////////buyGive满赠
}else if ([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.spType]isEqualToString:@"buyGive"]&& GoodsInOrderListModel.plans.count>0 ) {
       
        if (GoodsInOrderListModel.items.count>0) {
            [self setChoose:@"重领赠品"];
            UIImageView *_hengxian = [[UIImageView alloc]initWithFrame:CGRectMake(10,142-0.5, ScreenWidth-20, 0.5)];
            _hengxian.image=[UIImage imageNamed:@"hengxian"];
            [self addSubview:_hengxian];
                
                for (int i = 0; i<GoodsInOrderListModel.items.count; i++) {
                    _deleteBtn=[[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth-60, 142+(90*i), 60, 90)];
                    [_deleteBtn setTitle:[NSString stringWithFormat:@"%@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"id"]] forState:UIControlStateNormal];
                    _deleteBtn.backgroundColor=[UIColor redColor];
                    [_deleteBtn setTitleColor:[UIColor clearColor]  forState:UIControlStateNormal];
                    _deleteBtn .titleLabel.font=[UIFont systemFontOfSize:13];
                    [_deleteBtn addTarget:self action:@selector(deleteBtnBtn:) forControlEvents:UIControlEventTouchUpInside];
                    [self addSubview:_deleteBtn];
                    UILabel*delete = [[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-60, 142+(90*i), 60, 90)];
                    delete.font=[UIFont systemFontOfSize:14];
                    delete.textAlignment=NSTextAlignmentCenter;
                    delete.textColor=[UIColor whiteColor];
                    delete.text=@"删除";
                    [self addSubview:delete];

                    GoodView = [[GetAddBuyGoodsView alloc]initWithFrame:CGRectMake(0, 142+(90*i), ScreenWidth, 90)];
                    GoodView.backgroundColor=[UIColor whiteColor];
                    [GoodView.headImageFull setImageWithURL:[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"headImageFull"] placeholderImage:[UIImage imageNamed:@"zhengfangxing"]];
                    GoodView.headImageFull.layer.borderColor=[[UIColor colorWithRed:239.0f/255.0f green:239.0f/255.0f blue:239.0f/255.0f alpha:1] CGColor];
                    GoodView.headImageFull.layer.borderWidth= 0.5f;

                    
                    
                    NSString *tagName =[NSString stringWithFormat:@"%@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"productTypeName"]];
                    UIFont *tagNamefont1 = [UIFont systemFontOfSize:13];
                    CGSize tagNamesize1 = CGSizeMake(ScreenWidth-60, 2000);
                    CGSize tagNamelabelsize1 = [tagName sizeWithFont:tagNamefont1 constrainedToSize:tagNamesize1 lineBreakMode:NSLineBreakByCharWrapping];
                    UILabel*_productType =[[UILabel alloc]initWithFrame:CGRectMake(80, 15,  tagNamelabelsize1.width,13)];
                    _productType.textColor=[UIColor redColor];
                    [_productType.layer setCornerRadius:2];
                    _productType.text=tagName;
                    [_productType.layer setBorderWidth:0.5];
                    [_productType.layer setMasksToBounds:YES];
                    CGColorSpaceRef colorSpace12 = CGColorSpaceCreateDeviceRGB();
                    CGColorRef colorref12 = CGColorCreate(colorSpace12,(CGFloat[]){ 252/255.0, 54/255.0, 30/255.0, 1.0 });
                    [_productType.layer setBorderColor:colorref12];//边框颜色
                    _productType.font=[UIFont systemFontOfSize:10];
                    _productType.textAlignment=NSTextAlignmentCenter;
                    [GoodView addSubview:_productType];
                    
                    
                    
                    NSString *s1 =[NSString stringWithFormat:@"%@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"itemName"]];
                    UIFont *font1 = [UIFont systemFontOfSize:13];
                    CGSize size1 = CGSizeMake(ScreenWidth-85-tagNamelabelsize1.width-15, 2000);
                    CGSize labelsize1 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
                    
                    UILabel*_itemName = [[UILabel alloc]initWithFrame:CGRectMake(_productType.right+5, 15, ScreenWidth-85-tagNamelabelsize1.width-15, labelsize1.height)];
                    _itemName.numberOfLines=0;
                    _itemName.text=s1;
                    _itemName.textColor=[UIColor blackColor];
                    _itemName.font=[UIFont systemFontOfSize:13];
                    [GoodView addSubview:_itemName];
                    
                    
                    
                    UILabel*specName = [[UILabel alloc]initWithFrame:CGRectMake(_productType.right+5, _itemName.bottom+3, ScreenWidth-85-tagNamelabelsize1.width-15, 12)];
                    specName.text=[NSString stringWithFormat:@"%@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"specName"]];
                    specName.font=[UIFont systemFontOfSize:12];
                    specName.textColor=shenhuiColor;
                    [GoodView addSubview:specName];
                    
                    UILabel*dealPrice =  [[UILabel alloc]initWithFrame:CGRectMake(_productType.right+5, 60, ScreenWidth-85-tagNamelabelsize1.width-15, 12)];
                    dealPrice.font=[UIFont systemFontOfSize:12];
                    dealPrice.textColor=shenhuiColor;
                    NSNumber*Total =[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"promotionPrice"];
                    
                    NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
                    [numberFormatter setPositiveFormat:@"###,##0.00;"];
                    NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:Total.doubleValue]];
                    dealPrice.text=[NSString stringWithFormat:@"¥ %@",formattedNumberString];
                    dealPrice.textColor=zhonghuiColor;
                    [GoodView addSubview:dealPrice];
                    
                    GoodView.quantity.text=[NSString stringWithFormat:@"x %@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"quantity"]];
                    
                    
                    [self addSubview:GoodView];
                    
                    UISwipeGestureRecognizer*leftSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipes:)];
                    UISwipeGestureRecognizer*rightSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipes:)];
                    
                    leftSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
                    rightSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionRight;
                    
                    [GoodView addGestureRecognizer:leftSwipeGestureRecognizer];
                    [GoodView addGestureRecognizer:rightSwipeGestureRecognizer];

                    
                    
                }
         

      
        }else{
            
            if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planType]isEqualToString:@"P003"]) {
                
                if ([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planStatus]isEqualToString:@"Y"]&&[[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.hasGift]isEqualToString:@"Y"]) {
                    [self setChoose:@"领赠品"];
                }else{
              
                    if ([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planStatus]isEqualToString:@"N"]){
                    
                    [self setChoose:@"去凑单"];
        
                    }else{
                    
                    }

                }
            
            
            
            }else{
                if ([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planStatus]isEqualToString:@"Y"]) {
                    [self setChoose:@"领赠品"];
                }else{
                }
          
            }
        
        }
        
        if (GoodsInOrderListModel.plans.count>1) {
          [self jiazaiView:[NSString stringWithFormat:@"%f",GoodsInOrderListModel.getWeiboHight]:GoodsInOrderListModel.plans ];
            
        }else{
          
        }
//4//////////////////buyDown满减
}else if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.spType]isEqualToString:@"buyDown"]&&GoodsInOrderListModel.plans.count>0) {
        
            if (GoodsInOrderListModel.plans.count>1) {
                [self jiazaiView:[NSString stringWithFormat:@"%f",GoodsInOrderListModel.getWeiboHight]:GoodsInOrderListModel.plans ];
                
            }else{
        }
    
    if ([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planStatus]isEqualToString:@"Y"]) {
        
    }else{
        [self setChoose:@"去凑单"];
    }

//5//////////////////buyDiscount满折
}else if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.spType]isEqualToString:@"buyDiscount"]&&GoodsInOrderListModel.plans.count>0) {
            if (GoodsInOrderListModel.plans.count>1) {
                [self jiazaiView:[NSString stringWithFormat:@"%f",GoodsInOrderListModel.getWeiboHight]:GoodsInOrderListModel.plans ];
                
            }else{
                
            }
    
    if ([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planStatus]isEqualToString:@"Y"]) {

    }else{
        [self setChoose:@"去凑单"];
    }

    
//6/////////////////////buySecondN件折
}else if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.spType]isEqualToString:@"buySecond"]&&GoodsInOrderListModel.plans.count>0) {
    
    if (GoodsInOrderListModel.plans.count>1) {//
        [self jiazaiView:[NSString stringWithFormat:@"%f",GoodsInOrderListModel.getWeiboHight]:GoodsInOrderListModel.plans ];
        
    }else{
        
    }
    if ([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planStatus]isEqualToString:@"Y"]) {
        
    }else{
        [self setChoose:@"去凑单"];
}
   
//7//////////////////buyAddPrice加价购
}else if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.spType]isEqualToString:@"buyAddPrice"]&&GoodsInOrderListModel.plans.count>0) {
        if (GoodsInOrderListModel.items.count>0) {
            [self setChoose:@"重新换购"];
            UIImageView *_hengxian = [[UIImageView alloc]initWithFrame:CGRectMake(10,142-0.5, ScreenWidth-20, 0.5)];
            _hengxian.image=[UIImage imageNamed:@"hengxian"];
            [self addSubview:_hengxian];
            
            for (int i = 0; i<GoodsInOrderListModel.items.count; i++) {
                
                _deleteBtn=[[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth-60, 142+(90*i), 60, 90)];
                [_deleteBtn setTitle:[NSString stringWithFormat:@"%@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"id"]] forState:UIControlStateNormal];
                _deleteBtn.backgroundColor=[UIColor redColor];
                [_deleteBtn setTitleColor:[UIColor clearColor]  forState:UIControlStateNormal];
                _deleteBtn .titleLabel.font=[UIFont systemFontOfSize:13];
                [_deleteBtn addTarget:self action:@selector(deleteBtnBtn:) forControlEvents:UIControlEventTouchUpInside];
                [self addSubview:_deleteBtn];
                UILabel*delete = [[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-60, 142+(90*i), 60, 90)];
                delete.font=[UIFont systemFontOfSize:14];
                delete.textAlignment=NSTextAlignmentCenter;
                delete.textColor=[UIColor whiteColor];
                delete.text=@"删除";
                [self addSubview:delete];
                
                GoodView = [[GetAddBuyGoodsView alloc]initWithFrame:CGRectMake(0, 142+(90*i), ScreenWidth, 90)];
                GoodView.backgroundColor=[UIColor whiteColor];
                [GoodView.headImageFull setImageWithURL:[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"headImageFull"] placeholderImage:[UIImage imageNamed:@"zhengfangxing"]];
                GoodView.headImageFull.layer.borderColor=[[UIColor colorWithRed:239.0f/255.0f green:239.0f/255.0f blue:239.0f/255.0f alpha:1] CGColor];
                GoodView.headImageFull.layer.borderWidth= 0.5f;
                NSString *tagName =[NSString stringWithFormat:@"%@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"productTypeName"]];
                UIFont *tagNamefont1 = [UIFont systemFontOfSize:13];
                CGSize tagNamesize1 = CGSizeMake(ScreenWidth-60, 2000);
                CGSize tagNamelabelsize1 = [tagName sizeWithFont:tagNamefont1 constrainedToSize:tagNamesize1 lineBreakMode:NSLineBreakByCharWrapping];
                UILabel*_productType =[[UILabel alloc]initWithFrame:CGRectMake(80, 15,  tagNamelabelsize1.width,13)];
                _productType.textColor=[UIColor redColor];
                [_productType.layer setCornerRadius:2];
                _productType.text=tagName;
                [_productType.layer setBorderWidth:0.5];
                [_productType.layer setMasksToBounds:YES];
                CGColorSpaceRef colorSpace12 = CGColorSpaceCreateDeviceRGB();
                CGColorRef colorref12 = CGColorCreate(colorSpace12,(CGFloat[]){ 252/255.0, 54/255.0, 30/255.0, 1.0 });
                [_productType.layer setBorderColor:colorref12];//边框颜色
                _productType.font=[UIFont systemFontOfSize:10];
                _productType.textAlignment=NSTextAlignmentCenter;
                [GoodView addSubview:_productType];
                
                
                
                NSString *s1 =[NSString stringWithFormat:@"%@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"itemName"]];
                UIFont *font1 = [UIFont systemFontOfSize:13];
                CGSize size1 = CGSizeMake(ScreenWidth-85-tagNamelabelsize1.width-15, 2000);
                CGSize labelsize1 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
                
                UILabel*_itemName = [[UILabel alloc]initWithFrame:CGRectMake(_productType.right+5, 15, ScreenWidth-85-tagNamelabelsize1.width-15, labelsize1.height)];
                _itemName.numberOfLines=0;
                _itemName.text=s1;
                _itemName.textColor=[UIColor blackColor];
                _itemName.font=[UIFont systemFontOfSize:13];
                [GoodView addSubview:_itemName];
                
                
                
                UILabel*specName = [[UILabel alloc]initWithFrame:CGRectMake(_productType.right+5, _itemName.bottom+3, ScreenWidth-85-tagNamelabelsize1.width-15, 12)];
                specName.text=[NSString stringWithFormat:@"%@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"specName"]];
                specName.font=[UIFont systemFontOfSize:12];
                specName.textColor=shenhuiColor;
                [GoodView addSubview:specName];
                
                UILabel*dealPrice =  [[UILabel alloc]initWithFrame:CGRectMake(_productType.right+5, 60, ScreenWidth-85-tagNamelabelsize1.width-15, 12)];
                dealPrice.font=[UIFont systemFontOfSize:12];
                dealPrice.textColor=shenhuiColor;
                NSNumber*Total =[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"dealPrice"];
                
                NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
                [numberFormatter setPositiveFormat:@"###,##0.00;"];
                NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:Total.doubleValue]];
                dealPrice.text=[NSString stringWithFormat:@"¥ %@",formattedNumberString];
                dealPrice.textColor=zhonghuiColor;
                [GoodView addSubview:dealPrice];
                
                GoodView.quantity.text=[NSString stringWithFormat:@"x %@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"quantity"]];
                
                [self addSubview:GoodView];
                UISwipeGestureRecognizer*leftSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipes:)];
                UISwipeGestureRecognizer*rightSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipes:)];
                
                leftSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
                rightSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionRight;
                
                [GoodView addGestureRecognizer:leftSwipeGestureRecognizer];
                [GoodView addGestureRecognizer:rightSwipeGestureRecognizer];
            }
            }else{
            
                if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planType]isEqualToString:@"P003"]) {
                    if ([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planStatus]isEqualToString:@"Y"]) {
                        [self setChoose:@"去换购"];
                    }else{
                        [self setChoose:@"去凑单"];
                    }
                    
                }else{
   
                    if ([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planStatus]isEqualToString:@"Y"]) {
                        [self setChoose:@"去换购"];
                    }else{
               
                    }
        }
            
        }
        if (GoodsInOrderListModel.plans.count>1) {//
            [self jiazaiView:[NSString stringWithFormat:@"%f",GoodsInOrderListModel.getWeiboHight]:GoodsInOrderListModel.plans ];
            
        }else{
            
        }

    
//8////////////////////////buySuit套装
}else if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.spType]isEqualToString:@"buySuit"]) {
    
    
      if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.productType]isEqualToString:@"Suit"]) {
           
            [self setChoose:@"重选套装"];
            
            for (int i = 0; i<GoodsInOrderListModel.items.count; i++) {
               
                GoodView1 = [[GetAddBuyGoodsView1 alloc]initWithFrame:CGRectMake(0, 125+(100*i), ScreenWidth, 100)];
                GoodView1.backgroundColor=[UIColor whiteColor];
                [GoodView1.headImageFull setImageWithURL:[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"headImageFull"] placeholderImage:[UIImage imageNamed:@"zhengfangxing"]];
                GoodView1.headImageFull.layer.borderColor=[[UIColor colorWithRed:239.0f/255.0f green:239.0f/255.0f blue:239.0f/255.0f alpha:1] CGColor];
                GoodView1.headImageFull.layer.borderWidth= 0.5f;
                 GoodView1.itemName.text=[NSString stringWithFormat:@"%@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"itemName"]];
                
                GoodView1.quantity.text=[NSString stringWithFormat:@"%@件/套 x %@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"suitItemQty"],[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"suitQty"]];
                
               GoodView1.deliveryQty.text=[NSString stringWithFormat:@"库存 %@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"invQty"]];
                
                NSMutableAttributedString *attriString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"库存 %@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"invQty"]]];
                [attriString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0] range:NSMakeRange(0, 2)];
                
                GoodView1.deliveryQty.attributedText=attriString;
                
                NSNumber*Total =[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"dealPrice"];
                
                NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
                [numberFormatter setPositiveFormat:@"###,##0.00;"];
                NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:Total.doubleValue]];
                GoodView1.dealPrice.text=[NSString stringWithFormat:@"¥ %@",formattedNumberString];
                GoodView1.dealPrice.textColor=zhonghuiColor;
                GoodView1.itemType.text=[NSString stringWithFormat:@"%@",[[GoodsInOrderListModel.items objectAtIndex:i] objectForKey:@"specName"]];
                    UIImageView *_hengxian = [[UIImageView alloc]initWithFrame:CGRectMake(10,0, ScreenWidth-20, 0.5)];
                    _hengxian.image=[UIImage imageNamed:@"hengxian"];
                    [GoodView1 addSubview:_hengxian];
                    [self addSubview:GoodView1];
          
               
                 if (GoodsInOrderListModel.plans.count>1) {
                     
                 }else{
                if (GoodsInOrderListModel.items.count-1==i) {
                    self.lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(10, 132+(100*GoodsInOrderListModel.items.count)+40-0.45, ScreenWidth-20, 0.45)];
                    [self.lineLabel setBackgroundColor:qianhuiColor];
                    [self addSubview:self.lineLabel];
                }
            }
        }
            
            }else{
            
            if ([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.planStatus]isEqualToString:@"Y"]) {
                [self setChoose:@"选择套装"];
            }
        }
       
        if (GoodsInOrderListModel.items.count>0) {//
            
            if (GoodsInOrderListModel.plans.count>1) {//
               [self jiazaiView:[NSString stringWithFormat:@"%ld",GoodsInOrderListModel.items.count*100+40+30]:GoodsInOrderListModel.plans ];
                
            }else{

            }
            
            
        }else{
            
            
            if (GoodsInOrderListModel.plans.count>1) {//
                [self jiazaiView:[NSString stringWithFormat:@"%f",GoodsInOrderListModel.getWeiboHight]:GoodsInOrderListModel.plans ];
                
            }else{
                
                 if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.productType]isEqualToString:@"Suit"]) {
                if (GoodsInOrderListModel.items.count>0) {
                    }else{
                    
                    self.lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(10, 142+GoodsInOrderListModel.getWeiboHight-0.45, ScreenWidth-20, 0.45)];
                    [self.lineLabel setBackgroundColor:qianhuiColor];
                    [self addSubview:self.lineLabel];
                }
            }

            }
       
        }
///////////////////////
}else{
        
        
        _productImageView.frame=CGRectMake(15, 20, 82, 82);
        _countParentView.frame=CGRectMake(ScreenWidth-125, 72, 110, 30);
         _productSpecNameLabel.frame=CGRectMake(109, 55, 200, 15);
        _productPriceLabel.frame=CGRectMake(109, 80, 200, 15);
        _productInvLabel.frame=CGRectMake(ScreenWidth-125, 55, 110, 15);
    
    if([[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.productType]isEqualToString:@"Gift"]) {
        NSString *s1 =[NSString stringWithFormat:@"    %@", GoodsInOrderListModel.itemName ];
        UIFont *font1 = [UIFont systemFontOfSize:14];
        CGSize size1 = CGSizeMake(ScreenWidth-125, 2000);
        CGSize labelsize12 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
        _productNameLabel.frame=CGRectMake(109, 20, ScreenWidth-125, labelsize12.height);
        _productNameLabel.numberOfLines=0;
    }else{
         NSString *s1 =[NSString stringWithFormat:@"%@", GoodsInOrderListModel.itemName ];
        UIFont *font1 = [UIFont systemFontOfSize:14];
        CGSize size1 = CGSizeMake(ScreenWidth-125, 2000);
        CGSize labelsize12 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
        _productNameLabel.frame=CGRectMake(109, 20, ScreenWidth-125, labelsize12.height);
        _productNameLabel.numberOfLines=0;
    }
    if (GoodsInOrderListModel.plans.count>1) {//
        [self jiazaiView:[NSString stringWithFormat:@"%f",GoodsInOrderListModel.getWeiboHight]:GoodsInOrderListModel.plans ];
        
    }else{
       
    }
    }
}
//    SelectedGoodNewHeaderDataModel *weibo = [headerModelArray objectAtIndex:indexPath.row];
    self.lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(10, GoodsInOrderListModel.getWeiboHight+142-0.45, ScreenWidth-20, 0.45)];
    [self.lineLabel setBackgroundColor:qianhuiColor];
    [self addSubview:self.lineLabel];
//    self.lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(10, GoodsInOrderListModel.getWeiboHight+142-0.45, ScreenWidth-20, 0.45)];
//    [self.lineLabel1 setBackgroundColor:qianhuiColor];
//    [self addSubview:self.lineLabel1];
    self.hengxianLine = [[UIImageView alloc]initWithFrame:CGRectMake(10,GoodsInOrderListModel.getWeiboHight+142-0.45, ScreenWidth-20, 0.5)];
    self.hengxianLine.image=[UIImage imageNamed:@"hengxian"];
    [self addSubview:self.hengxianLine];

    
    
}

-(void)deleteBtnBtn:(UIButton*)sender{

 [_mDelegate deleteBtnBtn:[NSString stringWithFormat:@"%@",sender.titleLabel.text]];

}

- (void)handleSwipes:(UISwipeGestureRecognizer *)sender
{

    
    if (sender.direction == UISwipeGestureRecognizerDirectionLeft) {
        [UIView beginAnimations:@"rotation" context:(__bridge void * _Nullable)(GoodView)];
        [UIView setAnimationDuration:0.45];
        
//        CGPoint labelPosition = CGPointMake(GoodView1.frame.origin.x - 100.0, GoodView1.frame.origin.y);
        GoodView.frame = CGRectMake( -60 ,GoodView.frame.origin.y , GoodView.frame.size.width, GoodView.frame.size.height);


        [UIView commitAnimations];

        
    }
    
    if (sender.direction == UISwipeGestureRecognizerDirectionRight) {
        
        [UIView beginAnimations:@"rotation" context:(__bridge void * _Nullable)(GoodView)];
        [UIView setAnimationDuration:0.45];
        GoodView.frame = CGRectMake( 0 , GoodView.frame.origin.y , GoodView.frame.size.width, GoodView.frame.size.height);
         [UIView commitAnimations];
        }
}


-(void)setChoose:(NSString *)str{

    _chooseBtn=[[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth-100, 0, 60, 42)];
    [_chooseBtn setTitle:str forState:UIControlStateNormal];
    [_chooseBtn setTitleColor:[UIColor colorWithRed:255/255.0 green:51/255.0 blue:0/255.0 alpha:1]  forState:UIControlStateNormal];
    _chooseBtn.contentHorizontalAlignment=UIControlContentHorizontalAlignmentRight;
    _chooseBtn .titleLabel.font=[UIFont systemFontOfSize:12];
    [_chooseBtn addTarget:self action:@selector(chooseBtn:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_chooseBtn];
    
    _chooseBtn1=[[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth-40, 5, 33, 33)];
    [_chooseBtn1 setTitle:str forState:UIControlStateNormal];
    [_chooseBtn1 setTitleColor:[UIColor clearColor]  forState:UIControlStateNormal];
    [_chooseBtn1 setImage:[UIImage imageNamed:@"shouqi"] forState:UIControlStateNormal];
    [_chooseBtn1 addTarget:self action:@selector(chooseBtn:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_chooseBtn1];

}

-(void)jiazaiView:(NSString*)Hight :(NSMutableArray*)planTitle{

    UIView*youhuiView=[[UIView alloc] initWithFrame:CGRectMake(0, 142+Hight.intValue-40, ScreenWidth, 40)];
    youhuiView.backgroundColor=[UIColor clearColor];
    [self addSubview:youhuiView];
    
    UILabel*conditionsContenLabel=[[UILabel alloc] initWithFrame:CGRectMake(15, 11, ScreenWidth, 18)];
    [conditionsContenLabel setText:[NSString stringWithFormat:@"%@",@"优惠"]];
    conditionsContenLabel.font=[UIFont systemFontOfSize:13];
    conditionsContenLabel.textColor= [UIColor redColor];
    [youhuiView addSubview:conditionsContenLabel];
    
    for (NSDictionary* dicc in planTitle )
    {
        
        if ([[NSString stringWithFormat:@"%@",  [dicc objectForKey:@"isCurrent"]]isEqualToString:@"Y"]) {
            UILabel*conditionsConten=[[UILabel alloc] initWithFrame:CGRectMake(46, 0, ScreenWidth-75-48-10, 40)];
            [conditionsConten setText:[NSString stringWithFormat:@"%@",[NSString stringWithFormat:@"%@",  [dicc objectForKey:@"planTitle"]]]];
            conditionsConten.font=[UIFont systemFontOfSize:12];
            conditionsConten.textColor=zhonghuiColor;
            [youhuiView addSubview:conditionsConten];
        } //默认的
        

    }

    _modifyTheBtn=[[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth-65, 100+Hight.intValue+7.5, 50, 25)];
    [_modifyTheBtn setTitle:@"修改" forState:UIControlStateNormal];
    [_modifyTheBtn.layer setCornerRadius:2];
    [_modifyTheBtn.layer setBorderWidth:0.5];
    [_modifyTheBtn.layer setMasksToBounds:YES];
    _modifyTheBtn.layer.borderColor=[[UIColor colorWithRed:204/255.0 green:204/255.0 blue:204/255.0 alpha:1] CGColor];
    [_modifyTheBtn setTitleColor:shenhuiColor  forState:UIControlStateNormal];
    _modifyTheBtn .titleLabel.font=[UIFont systemFontOfSize:13];
    [_modifyTheBtn addTarget:self action:@selector(modifyTheBtn:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_modifyTheBtn];

}
-(void)modifyTheBtn:(UIButton *)sender{
        [_mDelegate modifyTheBtn:[NSString stringWithFormat:@"%ld",sender.tag]];
}
-(void)chooseBtn:(UIButton *)sender{

    if ([sender.titleLabel.text isEqualToString:@"领赠品"]||[sender.titleLabel.text isEqualToString:@"重领赠品"]) {
        
        [_mDelegate chooseBtn:[NSString stringWithFormat:@"%ld",sender.tag]:[NSString stringWithFormat:@"%@",sender.titleLabel.text]];
    
    }else if ([sender.titleLabel.text isEqualToString:@"去换购"]||[sender.titleLabel.text isEqualToString:@"重新换购"]){
    
       [_mDelegate chooseBtn:[NSString stringWithFormat:@"%ld",sender.tag]:[NSString stringWithFormat:@"%@",sender.titleLabel.text]];
    
    }else if ([sender.titleLabel.text isEqualToString:@"选择套装"]||[sender.titleLabel.text isEqualToString:@"重选套装"]){
        
        [_mDelegate chooseBtn:[NSString stringWithFormat:@"%ld",sender.tag]:[NSString stringWithFormat:@"%@",sender.titleLabel.text]];
        
    }else if ([sender.titleLabel.text isEqualToString:@"去凑单"]||[sender.titleLabel.text isEqualToString:@"继续凑单"]){
        
        [_mDelegate chooseBtn:[NSString stringWithFormat:@"%ld",sender.tag]:[NSString stringWithFormat:@"%@",sender.titleLabel.text]];
        
    }
}

-(void)subtractCountBtn:(UIButton *)sender
{
    if ([sender.titleLabel.text isEqualToString:@"Y"]) {
         [_mDelegate subtractCountBtn:[NSString stringWithFormat:@"%ld",sender.tag]:@"Y"];
    }else{
    [_mDelegate subtractCountBtn:[NSString stringWithFormat:@"%ld",sender.tag]:@"N"];
    }
}
-(void)countBtn:(UIButton *)sender{
    if ([sender.titleLabel.text isEqualToString:@"Y"]) {
        [_mDelegate CountBtn:[NSString stringWithFormat:@"%ld",sender.tag]:@"Y"];
    }else{
        [_mDelegate CountBtn:[NSString stringWithFormat:@"%ld",sender.tag]:@"N"];
    }


}
-(void)addCountBtn:(UIButton *)sender{
    if ([sender.titleLabel.text isEqualToString:@"Y"]) {
        [_mDelegate addCountBtn:[NSString stringWithFormat:@"%ld",sender.tag]:@"Y"];
    }else{
        [_mDelegate addCountBtn:[NSString stringWithFormat:@"%ld",sender.tag]:@"N"];
    }
//    [_mDelegate addCountBtn:[NSString stringWithFormat:@"%ld",sender.tag]:isSuit];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
